<?php

function mreadFile($path = NULL) {
    $data = array();
    //
    $file = fopen($path, "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
    while (!feof($file)) {
        $data[] = fgets($file);
    }
    fclose($file);
    //
    return $data;
}


function mwriteFile($path = NULL, $contents = array()) {
    
    $file = fopen($path, "w") or exit("Unable to open file!");
    
    foreach ($contents as $content) {
        fwrite($file, $content.PHP_EOL);
    }
    
    fclose($file); 
   
}